home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / machserver / 1.098 / fs / fsStat.h < prev    next >
C/C++ Source or Header  |  1991-06-27  |  24KB  |  599 lines

  1. /*
  2.  * fsStat.h --
  3.  *
  4.  *    Declarations for the file system statistics.
  5.  *
  6.  *    Note: since all variables are counters, they are unsigned
  7.  *    in order to make the high-order bit useable.
  8.  *
  9.  * Copyright 1986 Regents of the University of California
  10.  * All rights reserved.
  11.  *
  12.  *
  13.  * $Header: /sprite/src/kernel/fs/RCS/fsStat.h,v 9.15 91/06/27 17:37:07 mgbaker Exp $ SPRITE (Berkeley)
  14.  */
  15.  
  16. #ifndef _FSSTAT
  17. #define _FSSTAT
  18.  
  19. /*
  20.  * Note, both client and server Naming operations are kept.
  21.  */
  22. typedef struct Fs_NameOpStats {
  23.     unsigned int numReadOpens;        /* open(O_RDONLY) on client.  Count
  24.                      * of all server open calls */
  25.     unsigned int numWriteOpens;        /* open(O_WRONLY) */
  26.     unsigned int numReadWriteOpens;    /* open(O_RDWR) */
  27.     unsigned int chdirs;        /* Number Fs_ChangeDir */
  28.     unsigned int makeDevices;        /* Number Fs_MakeDevice */
  29.     unsigned int makeDirs;        /* Number Fs_MakeDirectory */
  30.     unsigned int removes;        /* Number Fs_Remove */
  31.     unsigned int removeDirs;        /* Number Fs_RemoveDirs */
  32.     unsigned int renames;        /* Number Fs_Rename */
  33.     unsigned int hardLinks;        /* Number Fs_HardLink */
  34.     unsigned int symLinks;        /* Number Fs_SymLink */
  35.     unsigned int getAttrs;        /* Number get attrs from name */
  36.     unsigned int setAttrs;        /* Number set attrs by name */
  37.     unsigned int getAttrIDs;        /* Number set attrs by open stream */
  38.     unsigned int setAttrIDs;        /* Number get attrs from open stream */
  39.     unsigned int getIOAttrs;        /* Number get attr from I/O server */
  40.     unsigned int setIOAttrs;        /* Number set attr to I/O server */
  41. } Fs_NameOpStats;
  42.  
  43. typedef struct Fs_GeneralStats {
  44.     unsigned int physBytesRead;        /* Number of physical (ie descriptors)
  45.                       * disk bytes read. */
  46.     unsigned int fileBytesRead;        /* Number of file bytes read from the
  47.                      * disk */
  48.     unsigned int fileReadOverflow;    /* Extra */
  49.     unsigned int remoteBytesRead;    /* Bytes read in Fsrmt_Read. */
  50.     unsigned int remoteReadOverflow;    /* Extra */
  51.     unsigned int deviceBytesRead;    /* Number of bytes read from devices */
  52.  
  53.     unsigned int physBytesWritten;    /* Number of physical disk bytes
  54.                      * written */
  55.     unsigned int fileBytesWritten;    /* Number of file bytes written to
  56.                      * the disk */
  57.     unsigned int fileWriteOverflow;    /* Extra */
  58.     unsigned int remoteBytesWritten;    /* Bytes written in Fsrmt_Write */
  59.     unsigned int remoteWriteOverflow;    /* Extra */
  60.     unsigned int deviceBytesWritten;    /* Number of bytes written to devices */
  61.     unsigned int fileBytesDeleted;    /* Number of file bytes deleted
  62.                      * (total) */
  63.     unsigned int fileDeleteOverflow;    /* Extra */
  64. } Fs_GeneralStats;
  65.  
  66. /*
  67.  * Cache statistics.
  68.  */
  69. typedef struct Fs_BlockCacheStats {
  70.     /*
  71.      * Read statistics.
  72.      */
  73.     unsigned int readAccesses;        /* Read fetches on the cache. */
  74.     unsigned int bytesRead;        /* Total bytes read from the cache
  75.                      * including misses read into cache */
  76.     unsigned int bytesReadOverflow;    /* Extra */
  77.     unsigned int readHitsOnDirtyBlock;    /* Fetches that hit on a block that had
  78.                       * dirty data in it. */
  79.     unsigned int readHitsOnCleanBlock;    /* Fetches that hit on a block that had
  80.                       * clean data in it. */
  81.     unsigned int readZeroFills;        /* Blocks that are zero filled
  82.                      * because read did not fill the
  83.                      * whole block. */
  84.     unsigned int domainReadFails;    /* Number of domain reads from
  85.                      * Fscache_Write and Fscache_Read that
  86.                      * were unsuccessful. */
  87.     unsigned int readAheads;        /* Number of read ahead processes
  88.                      * that were started up. */
  89.     unsigned int readAheadHits;        /* Number of reads that hit on a
  90.                      * block that was read ahead. */
  91.     unsigned int allInCacheCalls;    /* Number of time FscacheAllBlocksInCache routine
  92.                      * was called. */
  93.     unsigned int allInCacheTrue;        /* Number of times that FscacheAllBlocksInCache
  94.                      * returned TRUE. */
  95.     /*
  96.      * Write statistics.  See also WriteBackStats.
  97.      */
  98.     unsigned int writeAccesses;        /* Number of write fetches on the
  99.                      * cache. */
  100.     unsigned int bytesWritten;        /* Total bytes written to the cache
  101.                      * including new blocks */
  102.     unsigned int bytesWrittenOverflow;    /* Extra */
  103.     unsigned int appendWrites;        /* NEVER SET. Blocks written in 
  104.                      * append mode. */
  105.     unsigned int overWrites;        /* Cache blocks that were
  106.                      * overwritten. */
  107.     unsigned int writeZeroFills1;    /* Blocks that are zero filled because
  108.                      * read of old block did not fill
  109.                      * whole block. */
  110.     unsigned int writeZeroFills2;    /* Blocks that are zero filled because
  111.                      * user is only doing a partial write
  112.                      * to a new block. */
  113.     unsigned int partialWriteHits;    /* Read hits in the cache when are
  114.                      * writing to the middle of a block
  115.                      * and have to read in the data that
  116.                      * is already there. */
  117.     unsigned int partialWriteMisses;    /* Misses for above case. */
  118.     unsigned int blocksWrittenThru;    /* Number of dirty blocks that were
  119.                      * written thru. */
  120.     unsigned int dataBlocksWrittenThru;    /* Number of data block that were
  121.                      * written thru. */
  122.     unsigned int indBlocksWrittenThru;    /* Number of indirect blocks that
  123.                      * were written thru. */
  124.     unsigned int descBlocksWrittenThru;    /* Number of descriptor blocks that
  125.                      * were written thru. */
  126.     unsigned int dirBlocksWrittenThru;    /* Number of directory blocks that
  127.                      * were writtenw thru. */
  128.     /*
  129.      * Fragment statistics.
  130.      */
  131.     unsigned int fragAccesses;        /* Cache blocks that were fetched in
  132.                      * order to upgrade fragments. */
  133.     unsigned int fragHits;        /* Hits on fragAccesses. */
  134.     unsigned int fragZeroFills;        /* Cache blocks that had to be zero
  135.                      * filled because of frag upgrades. */
  136.     /*
  137.      * File descriptor accesses.
  138.      */
  139.     unsigned int fileDescReads;        /* File descriptor reads. */
  140.     unsigned int fileDescReadHits;    /* File descriptor hits in the cache. */
  141.     unsigned int fileDescWrites;    /* File descriptor writes. */
  142.     unsigned int fileDescWriteHits;    /* File descriptor write hits in the
  143.                      * cache. */
  144.     /*
  145.      * Indirect block accesses.
  146.      */
  147.     unsigned int indBlockAccesses;    /* Indirect block reads. */
  148.     unsigned int indBlockHits;        /* Access hits in the cache. */
  149.     unsigned int indBlockWrites;    /* Indirect blocks written. */
  150.     /*
  151.      * Directory block accesses.
  152.      */
  153.     unsigned int dirBlockAccesses;    /* Directory block reads. */
  154.     unsigned int dirBlockHits;        /* Directory block hits. */
  155.     unsigned int dirBlockWrites;    /* Directory block writes. */
  156.     unsigned int dirBytesRead;        /* Bytes read from directories */
  157.     unsigned int dirBytesWritten;    /* Bytes written to directories */
  158.     /*
  159.      * Variable size cache statistics.
  160.      */
  161.     unsigned int vmRequests;        /* Number of times virtual memory
  162.                      * requested memory from us. */
  163.     unsigned int triedToGiveToVM;    /* Number of vmRequests that we
  164.                      * tried to satisfy because
  165.                      * we had free blocks */
  166.     unsigned int vmGotPage;        /* Number of vmRequests that we
  167.                      * satisfied after checking LRU times */
  168.     /*
  169.      * Block allocation statistics.
  170.      */
  171.     unsigned int partFree;        /* Got the block off of the partially
  172.                      * free list. */
  173.     unsigned int totFree;        /* Got the block off of the totally
  174.                      * free list. */
  175.     unsigned int unmapped;        /* Created a new block. */
  176.     unsigned int lru;                /* Recycled a block. */
  177.     /*
  178.      * Cache size numbers.
  179.      */
  180.     unsigned int minCacheBlocks;    /* The minimum number of blocks that
  181.                       * can be in the cache. */
  182.     unsigned int maxCacheBlocks;    /* The maximum number of blocks that
  183.                       * can be in the cache. */
  184.     unsigned int maxNumBlocks;        /* The maximum number of blocks that
  185.                      * can ever be in the cache. */
  186.     unsigned int numCacheBlocks;    /* The actual number of blocks that
  187.                      * are in the cache. */
  188.     unsigned int numFreeBlocks;        /* The number of cache blocks that
  189.                      * aren't being used. */
  190.     /*
  191.      * Miscellaneous.
  192.      */
  193.     unsigned int blocksPitched;        /* The number of blocks that were
  194.                      * thrown out at the command of
  195.                      * virtual memory. */
  196.     int blocksFlushed;            /* The number of blocks written back
  197.                        due to consistency. */
  198.     int migBlocksFlushed;        /* The number of blocks written back
  199.                        due to consistency for migrated
  200.                        files. */
  201. } Fs_BlockCacheStats;
  202.  
  203. /*
  204.  * Block allocation statistics.
  205.  */
  206. typedef struct Fs_AllocStats {
  207.     unsigned int blocksAllocated;    /* Full blocks allocated. */
  208.     unsigned int blocksFreed;        /* Full blocks freed. */
  209.     unsigned int cylsSearched;        /* Cylinders searched to find a good
  210.                      * cylinder.*/
  211.     unsigned int cylHashes;        /* Hashes done to find a starting
  212.                      * cylinder. */
  213.     unsigned int cylBitmapSearches;    /* Cylinder bitmap entries searched. */
  214.     unsigned int fragsAllocated;    /* Fragments allocated. */
  215.     unsigned int fragsFreed;        /* Fragments freed. */
  216.     unsigned int fragToBlock;        /* Fragments that when freed made a
  217.                      * full block free. */
  218.     unsigned int fragUpgrades;        /* Fragments that were attempted to
  219.                      * be extended.*/
  220.     unsigned int fragsUpgraded;        /* Number of fragUpgrades that
  221.                      * were successful. */
  222.     unsigned int badFragList;        /* Fragment list entries that didn't
  223.                      * really have fragments of the
  224.                      * desired size.*/
  225.     unsigned int fullBlockFrags;    /* Full blocks that had to
  226.                      * be fragmented. */
  227. } Fs_AllocStats;
  228.  
  229. /*
  230.  * Name cache statistics.
  231.  */
  232. typedef struct Fs_NameCacheStats {
  233.     unsigned int accesses;        /* Number of times something was
  234.                      * looked for */
  235.     unsigned int hits;            /* Number of times it was found */
  236.     unsigned int replacements;        /* Number of entries recycled via LRU */
  237.     unsigned int size;            /* Number of entries total */
  238. } Fs_NameCacheStats;
  239.  
  240. /*
  241.  * Handle statistics.
  242.  */
  243. typedef struct Fs_HandleStats {
  244.     unsigned int maxNumber;    /* Current limit on table size. */
  245.     unsigned int exists;    /* Number of handles currently in existence. */
  246.     unsigned int installCalls;    /* Calls to Fsutil_HandleInstall. */
  247.     unsigned int installHits;    /* installs in which handle was found. */
  248.     unsigned int fetchCalls;    /* Calls to Fsutil_HandleFetch. */
  249.     unsigned int fetchHits;    /* fetches in which handle was found. */
  250.     unsigned int release;    /* Calls to Fsutil_HandleRelease. */
  251.     unsigned int locks;        /* Number of times a handle was locked. */
  252.     unsigned int lockWaits;    /* Number of times had to wait on a lock */
  253.     unsigned int unlocks;    /* Number of times a handle was unlocked. */
  254.     unsigned int created;    /* Handles that have been created. */
  255.     unsigned int lruScans;    /* Number of LRU replacement scans */
  256.     unsigned int lruChecks;    /* Number of handles checked for reclaimation */
  257.     unsigned int lruHits;    /* Number of handles actually reclaimed */
  258.     unsigned int lruEntries;    /* Number of handles in LRU list. */
  259.     unsigned int limbo;        /* Number of handles marked for removal */
  260.     /*
  261.      * The following are specific to regular files.
  262.      */
  263.     unsigned int versionMismatch; /* Version mismatch on file. */
  264.     unsigned int cacheFlushes;    /* Cache flushed because of version mismatch
  265.                  * of not cacheable. */
  266.     unsigned int segmentFetches; /* Calls by VM to see if there is indeed
  267.                   * already a segment with the code file. */
  268.     unsigned int segmentHits;    /* Segment fetches that return non-nil
  269.                  * segment. */
  270. } Fs_HandleStats;
  271.  
  272. /*
  273.  * Prefix table statistics.  These are client-side statistics
  274.  */
  275. typedef struct Fs_PrefixStats {
  276.     unsigned int relative;    /* Number of relative names encountered */
  277.     unsigned int absolute;    /* Number of absolute names subject to prefix
  278.                  * lookup */
  279.     unsigned int redirects;    /* Number of redirects from the server */
  280.     unsigned int loops;        /* Number of circular redirects */
  281.     unsigned int timeouts;    /* Number of times the server was down */
  282.     unsigned int stale;        /* Number of times server server rejected a
  283.                  * handle */
  284.     unsigned int found;        /* Number of times found a new prefix */
  285. } Fs_PrefixStats;
  286.  
  287. /*
  288.  * Name lookup statistics.  These are server-side statistics.
  289.  */
  290. typedef struct Fs_LookupStats {
  291.     unsigned int number;    /* Number of pathname lookups */
  292.     unsigned int numComponents;    /* Number of pathname components parsed */
  293.     unsigned int numSpecial;    /* Number of $MACHINE names encounted */
  294.     unsigned int forDelete;    /* Number for deletion */
  295.     unsigned int forLink;    /* Number for linking */
  296.     unsigned int forRename;    /* Number for rename */
  297.     unsigned int forCreate;    /* Number for creation */
  298.     unsigned int symlinks;    /* Number of symbolic links encountered */
  299.     unsigned int redirect;    /* Number of redirects due to symbolic links */
  300.     unsigned int remote;    /* Number of redirects due to remote links */
  301.     unsigned int parent;    /* Number of redirects due to ".." */
  302.     unsigned int notFound;    /* Number of FILE_NOT_FOUND lookups */
  303. } Fs_LookupStats;
  304.  
  305. /*
  306.  * Counts of various file system objects.
  307.  */
  308. typedef struct Fs_ObjectStats {
  309.     int streams;
  310.     int streamClients;        /* Equal to streams, except during migration */
  311.     int files;            /* Local files, not including directories */
  312.     int rmtFiles;
  313.     int pipes;
  314.     int devices;
  315.     int controls;        /* Pdev and Pfs control streams */
  316.     int pseudoStreams;        /* One count for both client/server handles */
  317.     int remote;            /* All the various remote objects but files*/
  318.     int directory;
  319.     int dirFlushed;        /* Directories that were flushed */
  320.     int fileClients;        /* Number of consist.clientList entries */
  321.     int other;            /* For unknown objects */
  322. } Fs_ObjectStats;
  323.  
  324. /*
  325.  * File system recovery statistics.
  326.  */
  327. typedef struct Fs_RecoveryStats {
  328.     int number;            /* Number of reopens by this client */
  329.     int wants;            /* Calls to Fsutil_WantRecovery */
  330.     int waitOK;            /* Successful RecoveryWaits */
  331.     int waitFailed;        /* Unnsuccessful RecoveryWaits */
  332.     int waitAbort;        /* Interrupted RecoveryWaits */
  333.     int timeout;        /* Re-open's that timed out */
  334.     int failed;            /* Re-open's that failed */
  335.     int deleted;        /* Re-open's of a file that has been deleted */
  336.     int offline;        /* Re-open's of a file that is now offline */
  337.     int succeeded;        /* Re-open's that worked */
  338.     int clientCrashed;        /* Number of clients that crashed */
  339.     int clientRecovered;    /* Number of clients that re-opened files */
  340.     int    reopensAvoided;        /* Unneeded reopens skipped */
  341. } Fs_RecoveryStats;
  342.  
  343. /*
  344.  * Cache conistency statistics.
  345.  */
  346. typedef struct Fs_ConsistStats {
  347.     int files;            /* The number of times consistency was checked*/
  348.     int clients;        /* The number of clients considered */
  349.     int notCaching;        /* # of other clients that weren't caching */
  350.     int readCachingMyself;    /* # of clients that were read caching */
  351.     int readCachingOther;    /* # of other clients that were read caching */
  352.     int writeCaching;        /* # of lastWriters that re-opened  */
  353.     int writeBack;        /* # of lastWriters forced to write-back */
  354.     int readInvalidate;        /* # of readers forced to stop caching */
  355.     int writeInvalidate;    /* # of writers forced to stop caching */
  356.     int nonFiles;        /* # of directories, links, etc. */
  357.     int swap;            /* # of uncached swap files. */
  358.     int cacheable;        /* # of files that were cacheable */
  359.     int uncacheable;        /* # of files that were not cacheable */
  360. } Fs_ConsistStats;
  361.  
  362. /*
  363.  * (More) Write-back statistics.
  364.  */
  365. typedef struct Fs_WriteBackStats {
  366.     int passes;            /* Number of times Fs_CleanBlocks called */
  367.     int files;            /* Number of dirty files processed */
  368.     int blocks;            /* Number of dirty blocks processed */
  369.     int maxBlocks;        /* Max blocks processed in one pass */
  370. } Fs_WriteBackStats;
  371.  
  372. /*
  373.  * Some miscellaneous stats to determine why we read remote bytes.
  374.  */
  375. typedef struct Fs_RemoteIOStats {
  376.     int blocksReadForVM;    /* Blocks read from Fs_PageRead (old) */
  377.     int bytesReadForCache;    /* Bytes read into the cache for remote files */
  378.     int bytesWrittenFromCache;    /* Bytes written from the cache for rmt files */
  379.     int uncacheableBytesRead;    /* Uncacheable bytes read (not counting swap) *
  380.                     * (FS_NOT_CACHEABLE flag) */
  381.     int uncacheableBytesWritten;/* Uncacheable bytes written *
  382.                     * (FS_NOT_CACHEABLE flag) */
  383.     int sharedStreamBytesRead;    /* Bytes read from shared uncacheable streams */
  384.     int sharedStreamBytesWritten;/* Bytes written to shared uncached streams */
  385.     int hitsOnVMBlock;        /* Code and Heap pages found in the cache */
  386.     int missesOnVMBlock;    /* Code and Heap pages not found in the cache */
  387.     int bytesReadForVM;        /* Bytes read in RmtFilePageRead */
  388.     int bytesWrittenForVM;    /* Bytes written in RmtFilePageWrite */
  389.     int    hitsOnHeapBlock;    /* Block in cache? */
  390.     int    missesOnHeapBlock;    /* Block not in cache? */
  391.     int    bytesReadForHeap;        /* Heap bytes read into cache */
  392.     int    bytesReadForHeapUncached;    /* Unached heap bytes read */
  393. } Fs_RemoteIOStats;
  394.  
  395. /*
  396.  * Statistics relating to migration.
  397.  */
  398. typedef struct Fs_MigStats {
  399.     unsigned int filesEncapsulated;     /* Total number of files encapsulated
  400.                        by this host */
  401.     unsigned int filesDeencapsulated;     /* Total number of files deencapsulated
  402.                        by this host */
  403.     unsigned int consistActions;     /* Total number of files for which
  404.                        this host was the i/o server doing
  405.                        consistency */
  406.     unsigned int readOnlyFiles;     /* Total number of files deencapsulated
  407.                        read-only */
  408.     unsigned int alreadyThere;         /* Total number of (writable) files
  409.                        already on target. NOT USED. */
  410.     unsigned int uncacheableFiles;     /* Total number of files deencapsulated
  411.                        that were uncacheable to begin
  412.                        with, and stayed that way. */
  413.     unsigned int cacheWritableFiles;     /* Total number of cacheable, writable
  414.                        files that were still cacheable
  415.                        after migration. */
  416.     unsigned int uncacheToCacheFiles;     /* Total number of uncacheable
  417.                        files that became cacheable after
  418.                        migration. */
  419.     unsigned int cacheToUncacheFiles;     /* Total number of cacheable
  420.                        files that became uncacheable after
  421.                        migration. */
  422.     unsigned int errorsOnDeencap;    /* Any files that couldn't be
  423.                        deencapsulated due to errors. */
  424.     unsigned int encapSquared;         /* Sum of squares for
  425.                        filesEncapsulated. */
  426.     unsigned int deencapSquared;     /* Sum of squares for
  427.                        filesDeencapsulated. */
  428. } Fs_MigStats;
  429.  
  430. /*
  431.  * File system statistics.
  432.  */
  433. #define FS_STAT_VERSION 2
  434. typedef struct Fs_Stats {
  435.     int            statsVersion;   /* Version number of statistics info */
  436.     Fs_NameOpStats    cltName;    /* Client-side naming operations */
  437.     Fs_NameOpStats    srvName;    /* Server-side naming operations */
  438.     Fs_GeneralStats    gen;        /* General I/O operations */
  439.     Fs_BlockCacheStats    blockCache;    /* Block cache operations */
  440.     Fs_AllocStats    alloc;        /* Disk allocation */
  441.     Fs_HandleStats    handle;        /* Handle management */
  442.     Fs_PrefixStats    prefix;        /* Client-side prefix operations */
  443.     Fs_LookupStats    lookup;        /* Server-side lookup operations */
  444.     Fs_NameCacheStats    nameCache;    /* Server name cache */
  445.     Fs_ObjectStats    object;        /* Counts of various objects */
  446.     Fs_RecoveryStats    recovery;    /* Crash recovery and reopening */
  447.     Fs_ConsistStats    consist;    /* Cache consistency actions */
  448.     Fs_WriteBackStats    writeBack;    /* Cache write-back stats */
  449.     Fs_RemoteIOStats    rmtIO;        /* Remote I/O stats */
  450.     Fs_MigStats        mig;        /* Migration */
  451. } Fs_Stats;
  452.  
  453. /*
  454.  * Keep a histogram of file lifetimes in a three-dimensional matrix,
  455.  * for lifetime, file size, and file type.  Buckets for size are
  456.  * scaled logarithmically.  Buckets for lifetime are determined as
  457.  * follows, where each bucket corresponds to a lifetime less than that
  458.  * value:
  459.  *
  460.  *    seconds: 1, 2, ..., 10, 20, ..., 50
  461.  *    minutes: 1, 2, ..., 10, 20, ..., 50
  462.  *      hours:   1, 2, ..., 10, 15, 20 (<24)
  463.  *    days:    1, 2, ..., 10, 20, .., 60, 90, 120, 180, 240, 300, 360, > 360
  464.  *
  465.  * For example, a file that is 0 seconds old is < 1 second and is in
  466.  * bucket 0; a file that is exactly 15 hours old is in the bucket labeled
  467.  * "20 hours" since that contains everything from 15 hours to
  468.  * (20 hours - 1 second).
  469.  *
  470.  * The divisions are somewhat arbitrary and are subject to change.
  471.  * Define the number of buckets here: 32 size buckets will cover 2 **
  472.  * 32 bytes (max file size); throw in one more bucket for subtotals by
  473.  * time.  For times, define an array containing the number of seconds
  474.  * and number of buckets for each group described above.
  475.  */
  476. #define FS_HIST_SIZE_BUCKETS     33
  477.  
  478. typedef struct Fs_HistGroupInfo {
  479.     unsigned int secondsPerBucket;
  480.     unsigned int bucketsPerGroup;
  481. } Fs_HistGroupInfo;
  482.  
  483.  
  484. #define FS_HIST_SECONDS        10
  485. #define FS_HIST_TEN_SECONDS    5
  486. #define FS_HIST_MINUTES        9
  487. #define FS_HIST_TEN_MINUTES    5
  488. #define FS_HIST_HOURS        9
  489. #define FS_HIST_FIVE_HOURS    2
  490. #define FS_HIST_REST_HOURS    1
  491. #define FS_HIST_DAYS        9
  492. #define FS_HIST_TEN_DAYS     5
  493. #define FS_HIST_THIRTY_DAYS     2
  494. #define FS_HIST_SIXTY_DAYS     4
  495. #define FS_HIST_REST_DAYS     1
  496.  
  497. #define FS_HIST_TIME_BUCKETS (FS_HIST_SECONDS + \
  498.                   FS_HIST_TEN_SECONDS + \
  499.                   FS_HIST_MINUTES + \
  500.                   FS_HIST_TEN_MINUTES + \
  501.                   FS_HIST_HOURS + \
  502.                   FS_HIST_FIVE_HOURS + \
  503.                   FS_HIST_REST_HOURS + \
  504.                   FS_HIST_DAYS + \
  505.                   FS_HIST_TEN_DAYS + \
  506.                   FS_HIST_THIRTY_DAYS + \
  507.                   FS_HIST_SIXTY_DAYS + \
  508.                   FS_HIST_REST_DAYS)
  509.  
  510. /*
  511.  * The number of types that we gather statistics for.
  512.  */
  513. #define FS_STAT_NUM_TYPES 5
  514.  
  515. /*
  516.  * Subscripts for arrays that separate data for read and write.
  517.  */
  518. #define FS_STAT_READ 0
  519. #define FS_STAT_WRITE 1
  520.  
  521. typedef struct Fs_TypeStats {
  522.     unsigned int diskBytes[2][FS_STAT_NUM_TYPES];
  523.                     /* Number of bytes read/written from/to
  524.                  * different types of files on disk */
  525.     unsigned int cacheBytes[2][FS_STAT_NUM_TYPES];
  526.                     /* Number of bytes read or written through
  527.                  * cache */
  528.     unsigned int bytesDeleted[FS_STAT_NUM_TYPES];
  529.                     /* Number of bytes deleted from files due
  530.                  * to truncation or removal */
  531.     unsigned int deleteHist    /* Histogram of deletions, by type */
  532.         [FS_HIST_TIME_BUCKETS] [FS_HIST_SIZE_BUCKETS] [FS_STAT_NUM_TYPES];
  533. } Fs_TypeStats;
  534.  
  535. Fs_TypeStats fs_TypeStats;
  536.  
  537. /*
  538.  * Macro to add to a counter, watching for overflow.  We use unsigned
  539.  * integers and wrap around if the high-order bit gets set.  This assumes
  540.  * that the amount to be added each time is
  541.  * relatively small (so we can't miss the overflow bit).
  542.  */
  543.  
  544. #define FS_STAT_OVERFLOW (1 << (sizeof(unsigned int) * 8 - 1))
  545. #define Fs_StatAdd(thisCount, counter, overflow) \
  546.     counter += thisCount; \
  547.     if (counter & FS_STAT_OVERFLOW) { \
  548.         overflow += 1; \
  549.         counter &= ~FS_STAT_OVERFLOW; \
  550.     }
  551.  
  552. #ifdef SOSP91
  553. typedef    struct    Fs_SospMigStats {
  554.     Fs_BlockCacheStats    blockCache;
  555.     Fs_RemoteIOStats    rmtIO;
  556.     Fs_GeneralStats    gen;
  557. } Fs_SospMigStats;
  558.     
  559.  
  560. extern    Fs_SospMigStats    fs_SospMigStats;
  561. #endif SOSP91
  562.  
  563. /*
  564.  * We've changed things so that heap pages are cacheable.
  565.  * In order to know how much of the vm bytes are found in the cache or not,
  566.  * we need these new counters.  bytesReadForCache now includes heap bytes
  567.  * as does bytesReadForVM, so we use this extra counter to know how much of
  568.  * that is so.
  569.  */
  570. #ifdef SOSP91
  571. typedef    struct Fs_NewStats {
  572.     int        uncacheableDirBytesRead;
  573.     int        uncacheableDirBytesReadMig;
  574.     int        CORPageServerRead;
  575.     int        CORPageServerReadM;
  576.     int        hitsOnCodePage;
  577.     int        hitsOnCodePageM;
  578.     int        hitsOnSwapPage;
  579.     int        hitsOnSwapPageM;
  580.     int        missesOnCodePage;
  581.     int        missesOnCodePageM;
  582.     int        missesOnSwapPage;
  583.     int        missesOnSwapPageM;
  584.     int        psFilledM;
  585.     int        fsFilledM;
  586.     int        zeroFilledM;
  587.     int        totalFaultsM;
  588.     int        remoteDevicishBytesRead;
  589.     int        remoteDevicishBytesReadM;
  590.     int        COWCopySwapPage;
  591.     int        COWCopySwapPageM;
  592. } Fs_NewStats;
  593. extern    Fs_NewStats    fs_MoreStats;
  594. #endif SOSP91
  595.  
  596. extern    Fs_Stats    fs_Stats;
  597.  
  598. #endif _FSSTAT
  599.